package com.filebackup.struts.actions;

import com.filebackup.business.UserService;
import com.filebackup.vo.Vo;
import com.filebackup.vo.impl.UserVo;

public class LoginAction extends FilebackupSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String name;
	private String passwd;
	private UserService userService;
	
	public String execute() throws Exception{
		UserVo userVo=new UserVo();
		System.out.println(name);
		System.out.println(passwd);
		userVo.setName(name);
		userVo.setPasswd(passwd);
		Vo vo=userService.isUserExist(userVo);
		if(vo!=null){
			this.setSessionUser((UserVo)vo);
			return SUCCESS;
		}
		return "fail";
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}
	public String getPasswd() {
		return passwd;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	public UserService getUserService() {
		return userService;
	}

}
